using System.ComponentModel.DataAnnotations;

namespace CaipuGuanliXitong.Models;

public class RecipeIngredientDto
{
    [Required(ErrorMessage = "请选择菜谱")]
    public int CookBookId { get; set; }
    
    public string CookBookName { get; set; } = string.Empty;
    
    [Required(ErrorMessage = "请至少选择一个食材")]
    public List<IngredientSelection> Ingredients { get; set; } = new List<IngredientSelection>();
}

public class IngredientSelection
{
    public int IngredientId { get; set; }
    
    [Range(0.001, double.MaxValue, ErrorMessage = "用量必须大于0")]
    public decimal Quantity { get; set; }
}